<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <!-- 通过循环按行顺序为一个5×5的二维数组a赋1到25的自然数，然后输出该数组。试编程。 
    // 结果 [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25] ] -->
    <script>
        var arr = [];
        var arr1 = [];
        for (var i = 1; i <= 25; i++) {
            arr1.push(i);

            if (i % 5 === 0) {
                arr.push(arr1);
                arr1 = []; //清空数组

            }


        }

        console.log(arr);
        // console.log(arr1);
    </script>
</body>

</html>